package com.qmy.service;

import com.qmy.dao.UserMapper;
import com.qmy.pojo.User;
import com.qmy.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class UserService {
      public void getUserList(){
        //第一步 获取 sqlseession对象
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        //方式1执行sql
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        List<User> userList = mapper.getUserList();
        for (User user : userList){
            System.out.println(user);
        }
        sqlSession.close();


    }
}
